<?php
global $_GPC, $_W;
$uniacid = $_W['uniacid'];
$id = $_GPC['id'];
$cate_id = $_GPC['cate_id'];
$res = $this->res;
$plus = $this->plus;
load()->func('tpl');
$setting = $this->baseset($uniacid);
$allcate = pdo_fetchall("SELECT * FROM " . tablename($this->tablecate) . " WHERE uniacid = '{$_W['uniacid']} ' AND status=1 order by displayorder desc");
$allcateall = pdo_fetchall("SELECT * FROM " . tablename($this->tablecateall) . " WHERE uniacid = '{$_W['uniacid']} ' AND status=1 order by displayorder desc");
$indexcate = pdo_fetchall("SELECT * FROM " . tablename($this->tablecate) . " WHERE uniacid = '{$_W['uniacid']} ' AND isindex=1 order by displayorder desc  LIMIT 7");
$indexcateall = pdo_fetchall("SELECT * FROM " . tablename($this->tablecateall) . " WHERE uniacid = '{$_W['uniacid']} ' AND isindex=1 order by displayorder desc  LIMIT 8");
$thiscate = pdo_fetch("SELECT * FROM " . tablename($this->tablecateall) . " WHERE uniacid = '{$_W['uniacid']}' AND status=1 AND id = '{$cate_id} '");
$info = pdo_fetch("SELECT * FROM " . tablename($this->tabletop) . " WHERE uniacid = '{$_W['uniacid']}' AND status=1 AND id = '{$id}' LIMIT 1");
if (empty($info)) {
	message('专题不存在！', $this->createWebUrl('listtops'), 'error');
} else {
	$toptitle = $info['title'];
	$topnum = $info['num'];
	if ($topnum == 0) {
		$topnum = '';
	}
	$itemsid = unserialize($info['topitems2']);
	foreach ($itemsid as $id => $value) {
		$show = pdo_fetch("SELECT * FROM " . tablename($this->tableitemall) . " WHERE uniacid = '{$_W['uniacid']}' AND id = '{$itemsid[$id]}' LIMIT 1");
		$itemsid['dat'][] = $show;
	}
	$allinfo = $itemsid['dat'];
}
if ($info['thumb']) {
	$_share['imgUrl'] = tomedia($info['thumb']);
} else {
	$_share['imgUrl'] = tomedia($setting['fxlogo']);
}
if ($info['fxdec']) {
	$_share['title'] = $info['fxdec'];
	$_share['desc'] = "好友向您推荐：" . $toptitle . $topnum;
} else {
	$_share['title'] = "好友向您推荐：" . $toptitle . $topnum;
	$_share['desc'] = $info['fxdec'];
}
$_share['link'] = $_W['siteroot'] . "app/index.php?i=" . $_W['uniacid'] . "&c=entry&do=list_top&m=bsht_tbk&id=" . $info['id'];
$pagename = $toptitle . $topnum;
$_W['page']['sitename'] = $setting['sitetitle'] . " - " . $toptitle . $topnum;
include $this->template('list_top');